package thread;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Li_DaChiZi
 * Date: 2025/6/25
 * Time: 15:52
 */
public class Demo35 {

    private static int result = 0;

    public static void main(String[] args) throws InterruptedException {
        Thread t = new Thread(() -> {
            int sum = 0;
            for (int i = 1; i <= 1000; i++) {
                sum += i;
            }
            result = sum;
        });

        t.start();
        t.join();
        System.out.println("result:" + result);
    }
}
